<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex donationPage_flex_0"
        :style="{height:(140+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub donationPage_fd0_0'>
          <view class='flex flex-wrap align-center donationPage_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='donationPage_fd0_0_c1_c0'>{{$t('捐赠')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end donationPage_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (140+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view>
          <benben-flex-tabs class-name='donationPage_benbenTabsfd1_0' v-model="tabls" ref="benben_tabsfd1_0"
            select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false' :open-sticky='false' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd1_0" @change="switchRequestFunc()">

            <scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left.sync="tabsInfofd1_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd1_0-content">
                <view id="benben_tabsfd1_0-title" class="benben-tabs-title flex align-center flex ">
                  <view
                    :class="{ 'checkTitlefd1_0': tabls == '2', 'flex flex-wrap align-center donationPage_titlefd1_0_c3': true }"
                    @tap="tabls = '2'" :id="`benben_tabsfd1_0-title-item-${'2'}`">

                    <text>{{isup==0 ? $t('线上功德捐款') : '功德列表'}}</text>

                  </view>
                  <view
                    :class="{ 'checkTitlefd1_0': tabls == '1', 'flex flex-wrap align-center donationPage_titlefd1_0_c3': true }"
                    @tap="tabls = '1'" :id="`benben_tabsfd1_0-title-item-${'1'}`">

                    <text>{{$t('功德福田')}}</text>

                  </view>

                </view>
                <view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
                  id="benben_tabsfd1_0-line" class="benben-tabs-line flex benben-flex-tabs-line donationPage_linefd1_0">
                </view>
              </view>
            </scroll-view>

          </benben-flex-tabs>

        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout donationPage_flex_2"
        v-if=" tabls=='1'">
        <template v-for='(item,key0) in fukudaList'>
          <view class='flex flex-wrap align-center donationPage_fd2_0' @tap.stop="handleJumpDiy" data-type="navigateTo"
            :data-url="`/pages/juanzeng/fieldsDetails/fieldsDetails?id=${item.aid}&state=${tabls}`" :key='key0'>
            <image class='donationPage_fd2_0_c0' mode="aspectFit" :src='item.img'></image>
            <view class='flex flex-direction flex-wrap align-stretch flex-sub donationPage_fd2_0_c1'>
              <text class='donationPage_fd2_0_c1_c0'>{{item.title}}</text>
              <view class='flex flex-wrap align-center donationPage_fd2_0_c1_c1'>
                <text class='donationPage_fd2_0_c1_c1_c0'>{{$t('发布时间：')}}</text>
                <text class='donationPage_fd2_0_c1_c1_c0'>{{item.create_time}}</text>
              </view>
              <view class='flex flex-wrap align-center donationPage_fd2_0_c1_c2'>
                <text class='donationPage_fd2_0_c1_c2_c0'>{{$t('已募捐')}}：</text>
                <text class='donationPage_fd2_0_c1_c2_c1'>$</text>
                <text class='donationPage_fd2_0_c1_c2_c1'>{{item.add_money}}</text>
              </view>
              <view class='flex flex-wrap align-center donationPage_fd2_0_c1_c2'>
                <text class='donationPage_fd2_0_c1_c2_c0'>{{$t('目标金额')}}：</text>
                <text class='donationPage_fd2_0_c1_c2_c1'>${{item.total_money}}</text>
              </view>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout donationPage_flex_3"
        v-if=" tabls=='2'">
        <template v-for='(item,key0) in donationList'>
          <view class='flex flex-wrap align-stretch donationPage_fd3_0' @tap.stop="handleJumpDiy" data-type="navigateTo"
            :data-url="`/pages/juanzeng/fieldsDetails/fieldsDetails?id=${item.aid}&state=${tabls}`" :key='key0'>
            <image class='donationPage_fd3_0_c0' mode="aspectFit" :src='item.img'></image>
            <view class='flex flex-direction flex-wrap align-stretch flex-sub'>
              <text class='donationPage_fd3_0_c1_c0'>{{item.title}}</text>
              <text class='donationPage_fd3_0_c1_c1'>{{item.name}}</text>
              <view class='flex flex-wrap align-center donationPage_fd3_0_c1_c2'>
                <text class='donationPage_fd3_0_c1_c2_c0'>{{$t('发布时间：')}}</text>
                <text class='donationPage_fd3_0_c1_c2_c0'>{{item.create_time}}</text>
              </view>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js';
  import {
    API_BASE_URL,
    SYSTEM_CONFIG
  } from '@/common/config.js'
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "tabsInfofd1_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "fukudaList": [],
        "tabls": "2",
        "donationList": [],
        isup: 0
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.switchRequestFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      if (uni.getSystemInfoSync().platform == 'ios') {
        this.$api.post(global.apiUrls.post64534cbb2c352, {
          code: 'is_sale',
          appVersion: SYSTEM_CONFIG.appVersion
        }).then(res => {
          this.isup = res.data.data
        })
      }
      uni.setTabBarItem({
        index: 0,
        text: this.$t('首页'),
        iconPath: '/static/tab/tab_diy0.png',
        selectedIconPath: '/static/tab/tab_diy0_active.png'
      })
      uni.setTabBarItem({
        index: 1,
        text: this.$t('灵岩妙音'),
        iconPath: '/static/tab/tab_diy1.png',
        selectedIconPath: '/static/tab/tab_diy1_active.png'
      })
      uni.setTabBarItem({
        index: 2,
        text: this.$t('功德'),
        iconPath: '/static/tab/tab_diy2.png',
        selectedIconPath: '/static/tab/tab_diy2_active.png'
      })
      uni.setTabBarItem({
        index: 3,
        text: this.$t('我的'),
        iconPath: '/static/tab/tab_diy3.png',
        selectedIconPath: '/static/tab/tab_diy3_active.png'
      })
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getFukudaFunc()
      this.getDonationFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //获取功德福田列表
      getFukudaFunc() {
        this.minixPagingListsApi = global.apiUrls.post65619cfd9faca;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {}
        this.listData = [];
        this.fukudaList = this.listData;
        this.pagingListToggle();

      },
      //获取捐款列表
      getDonationFunc() {
        this.minixPagingListsApi = global.apiUrls.post6566a2ae0eace;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {}
        this.listData = [];
        this.donationList = this.listData;
        this.pagingListToggle();

      },
      //切换请求
      switchRequestFunc() {
        if (this.tabls == '1') {
          this.getFukudaFunc()
        } else if (this.tabls == '2') {
          this.getDonationFunc()
        }
      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(247, 243, 237, 1);
    background-size: 100% auto;
  }

  .donationPage_flex_0 {
    background: url(image-path('18.png')) no-repeat;
    width: 750rpx;
    height: 140rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% 100%;
    border-radius: 0rpx 0rpx 56rpx 56rpx;
  }

  .donationPage_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
    line-height: 50rpx;
  }

  .donationPage_fd0_0_c0 {
    width: 120rpx;
  }

  .donationPage_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .donationPage_titlefd1_0_c3 {
    margin: 0rpx 107rpx 0rpx 0rpx;
  }

  .donationPage_linefd1_0 {
    background: rgba(145, 47, 34, 1);
    width: 16rpx;
    height: 16rpx;
    top: 72rpx;
    background-size: 100% auto !important;
    border-radius: 100rpx;
  }

  .checkTitlefd1_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #912F22 !important;
  }

  ::v-deep .donationPage_benbenTabsfd1_0 {
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    padding-left: 46px;
    font-size: 28rpx;
    font-weight: 400;
    color: #666666;
  }

  .donationPage_flex_2 {
    padding: 32rpx 32rpx 0rpx 32rpx;
  }

  .donationPage_fd2_0_c1_c2_c1 {
    color: #912F22;
    font-size: 26rpx;
    font-weight: 700;
    line-height: 36rpx;
  }

  .donationPage_fd2_0_c1_c2_c0 {
    color: #912F22;
    font-size: 22rpx;
    font-weight: 400;
    line-height: 36rpx;
  }

  .donationPage_fd2_0_c1_c2 {
    margin: 9rpx 0rpx 0rpx 0rpx;
  }

  .donationPage_fd2_0_c1_c1_c0 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 36rpx;
  }

  .donationPage_fd2_0_c1_c1 {
    margin: 8rpx 0rpx 0rpx 0rpx;
  }

  .donationPage_fd2_0_c1_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 42rpx;
  }

  .donationPage_fd2_0_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .donationPage_fd2_0_c0 {
    width: 160rpx;
    height: 160rpx;
    border-radius: 24rpx;
  }

  .donationPage_fd2_0 {
    background: rgba(255, 255, 255, 1);
    border-radius: 40rpx;
    background-size: 100% auto;
    padding: 32rpx 24rpx 32rpx 24rpx;
    margin: 0rpx 0rpx 24rpx 0rpx;
  }

  .donationPage_flex_3 {
    padding: 32rpx 32rpx 0rpx 32rpx;
  }

  .donationPage_fd3_0_c1_c2_c0 {
    color: #999999;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 36rpx;
  }

  .donationPage_fd3_0_c1_c2 {
    margin: auto 0rpx 0rpx 0rpx;
  }

  .donationPage_fd3_0_c1_c1 {
    color: #666666;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 36rpx;
    margin: 12rpx 0rpx 0rpx 0rpx;
  }

  .donationPage_fd3_0_c1_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 42rpx;
    width: 396rpx;
  }

  .donationPage_fd3_0_c0 {
    width: 160rpx;
    height: 160rpx;
    border-radius: 24rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .donationPage_fd3_0 {
    background: rgba(255, 255, 255, 1);
    border-radius: 40rpx;
    background-size: 100% auto;
    padding: 32rpx 24rpx 32rpx 24rpx;
    margin: 0rpx 0rpx 24rpx 0rpx;
  }
</style>
